package UIPackage;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import org.dyno.visual.swing.layouts.Constraints;
import org.dyno.visual.swing.layouts.GroupLayout;
import org.dyno.visual.swing.layouts.Leading;

import Sistem.*;
//VS4E -- DO NOT REMOVE THIS LINE!
public class SeferEkleGUI extends JFrame {

	private static final long serialVersionUID = 1L;
	private Register r;
	private JLabel jLabel0;
	private JLabel jLabel1;
	private JTextField jTextField0;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JLabel jLabel4;
	private JTextField jTextField1;
	private JTextField jTextField2;
	private JTextField jTextField3;
	private JLabel jLabel5;
	private JTextField jTextField4;
	private JButton jButton0;
	private JLabel jLabel6;
	private JLabel jLabel7;
	private JTextField jTextField5;
	private JTextField jTextField6;
	private static final String PREFERRED_LOOK_AND_FEEL = "javax.swing.plaf.metal.MetalLookAndFeel";
	public SeferEkleGUI(Register r){
		this.r=r;
		initComponents();
		jTextField0.setText(String.valueOf(r.getSeferID()));
		jTextField5.setText(r.getSeferKalkisHavalimaniAdi());
		jTextField6.setText(r.getSeferInisHavalimaniAdi());
	}
	public SeferEkleGUI() {
		initComponents();
	}

	private void initComponents() {
		setLayout(new GroupLayout());
		add(getJLabel5(), new Constraints(new Leading(45, 12, 12), new Leading(69, 10, 10)));
		add(getJTextField4(), new Constraints(new Leading(165, 87, 10, 10), new Leading(69, 12, 12)));
		add(getJTextField1(), new Constraints(new Leading(165, 86, 12, 12), new Leading(113, 10, 10)));
		add(getJTextField2(), new Constraints(new Leading(165, 86, 12, 12), new Leading(157, 12, 12)));
		add(getJTextField3(), new Constraints(new Leading(165, 86, 12, 12), new Leading(201, 12, 12)));
		add(getJLabel2(), new Constraints(new Leading(45, 12, 12), new Leading(115, 12, 12)));
		add(getJLabel3(), new Constraints(new Leading(45, 12, 12), new Leading(159, 12, 12)));
		add(getJLabel4(), new Constraints(new Leading(45, 12, 12), new Leading(205, 12, 12)));
		add(getJLabel6(), new Constraints(new Leading(335, 10, 10), new Leading(115, 12, 12)));
		add(getJLabel7(), new Constraints(new Leading(335, 12, 12), new Leading(161, 12, 12)));
		add(getJLabel1(), new Constraints(new Leading(335, 12, 12), new Leading(71, 12, 12)));
		add(getJTextField0(), new Constraints(new Leading(482, 86, 12, 12), new Leading(67, 12, 12)));
		add(getJTextField5(), new Constraints(new Leading(482, 86, 12, 12), new Leading(111, 12, 12)));
		add(getJTextField6(), new Constraints(new Leading(482, 86, 12, 12), new Leading(157, 12, 12)));
		add(getJButton0(), new Constraints(new Leading(243, 10, 10), new Leading(277, 10, 10)));
		add(getJLabel0(), new Constraints(new Leading(221, 12, 12), new Leading(24, 10, 10)));
		setSize(607, 354);
	}
	private JTextField getJTextField6() {
		if (jTextField6 == null) {
			jTextField6 = new JTextField();
		}
		return jTextField6;
	}
	private JTextField getJTextField5() {
		if (jTextField5 == null) {
			jTextField5 = new JTextField();
		}
		return jTextField5;
	}
	private JLabel getJLabel7() {
		if (jLabel7 == null) {
			jLabel7 = new JLabel();
			jLabel7.setText("İniş Havalimanı");
		}
		return jLabel7;
	}
	private JLabel getJLabel6() {
		if (jLabel6 == null) {
			jLabel6 = new JLabel();
			jLabel6.setText("Kalkış Havalimanı");
		}
		return jLabel6;
	}
	private JButton getJButton0() {
		if (jButton0 == null) {
			jButton0 = new JButton();
			jButton0.setText("Tamam");
			jButton0.addMouseListener(new MouseAdapter() {
	
				public void mouseClicked(MouseEvent event) {
					jButton0MouseMouseClicked(event);
				}
			});
		}
		return jButton0;
	}
	private JTextField getJTextField4() {
		if (jTextField4 == null) {
			jTextField4 = new JTextField();
		}
		return jTextField4;
	}
	private JLabel getJLabel5() {
		if (jLabel5 == null) {
			jLabel5 = new JLabel();
			jLabel5.setText("Sefer Adı");
		}
		return jLabel5;
	}
	private JTextField getJTextField3() {
		if (jTextField3 == null) {
			jTextField3 = new JTextField();
		}
		return jTextField3;
	}
	private JTextField getJTextField2() {
		if (jTextField2 == null) {
			jTextField2 = new JTextField();
		}
		return jTextField2;
	}
	private JTextField getJTextField1() {
		if (jTextField1 == null) {
			jTextField1 = new JTextField();
		}
		return jTextField1;
	}
	private JLabel getJLabel4() {
		if (jLabel4 == null) {
			jLabel4 = new JLabel();
			jLabel4.setText("Uçuş Süresi");
		}
		return jLabel4;
	}
	private JLabel getJLabel3() {
		if (jLabel3 == null) {
			jLabel3 = new JLabel();
			jLabel3.setText("İrtifa");
		}
		return jLabel3;
	}
	private JLabel getJLabel2() {
		if (jLabel2 == null) {
			jLabel2 = new JLabel();
			jLabel2.setText("Mesafe");
		}
		return jLabel2;
	}
	private JTextField getJTextField0() {
		if (jTextField0 == null) {
			jTextField0 = new JTextField();
		}
		return jTextField0;
	}
	private JLabel getJLabel1() {
		if (jLabel1 == null) {
			jLabel1 = new JLabel();
			jLabel1.setText("SeferID");
		}
		return jLabel1;
	}
	private JLabel getJLabel0() {
		if (jLabel0 == null) {
			jLabel0 = new JLabel();
			jLabel0.setText("Sefer Bilgileri Bilgi Formu");
		}
		return jLabel0;
	}
	private static void installLnF() {
		try {
			String lnfClassname = PREFERRED_LOOK_AND_FEEL;
			if (lnfClassname == null)
				lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName();
			UIManager.setLookAndFeel(lnfClassname);
		} catch (Exception e) {
			System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL
					+ " on this platform:" + e.getMessage());
		}
	}

	/**
	 * Main entry of the class.
	 * Note: This class is only created so that you can easily preview the result at runtime.
	 * It is not expected to be managed by the designer.
	 * You can modify it as you like.
	 */
	public static void main(String[] args) {
		installLnF();
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				SeferEkleGUI frame = new SeferEkleGUI();
				frame.setDefaultCloseOperation(SeferEkleGUI.EXIT_ON_CLOSE);
				frame.setTitle("SeferEkle");
				frame.getContentPane().setPreferredSize(frame.getSize());
				frame.pack();
				frame.setLocationRelativeTo(null);
				frame.setVisible(true);
			}
		});
	}
	private void jButton0MouseMouseClicked(MouseEvent event) {
		String seferAdi=jTextField4.getText();
		int seferID=Integer.parseInt(jTextField0.getText());
		float mesafe=Float.valueOf(jTextField1.getText());
		float irtifa=Float.valueOf(jTextField2.getText());
		float ucusSuresi=Float.valueOf(jTextField3.getText());
		r.seferBilgiGir(seferAdi, mesafe, irtifa, ucusSuresi);
		SeferOnayGUI form = new SeferOnayGUI(r);
		this.hide();
		form.show();
		
	}

}
